package de.graph.common;


import java.util.Set;

/**
 * An element is the base class for both vertices and edges.
 * An element can maintain a collection of key/value properties.
 */
public interface Element {

    /**
     * Return the label associated with the element.
     * 
     * @return the element label (not unique)
     */
    public String getLabel();

    /**
     * Return the object value associated with the provided string key.
     *
     * @param key the key of the key/value property
     * @return the object value related to the string key
     */
    public <ValueType> ValueType getProperty(String key);

    /**
     * Assign a key/value property to the element.
     * If a value already exists for this key, then the previous key/value is overwritten.
     *
     * @param key   the string key of the property
     * @param value the object value o the property
     */
    public <ValueType> void setProperty(String key, ValueType value);

    /**
     * Unassigns a key/value property from the element.
     * The object value of the removed property is returned.
     *
     * @param key the key of the property to remove from the element
     * @return the object value associated with that key prior to removal
     */
    public <ValueType> ValueType removeProperty(String key);

    /**
     * Return all the keys associated with the element.
     *
     * @return the set of all string keys associated with the element
     */
    public Set<String> getPropertyKeys();

}
